package com.ssy.lingxi.message.controller.inner;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.message.api.vo.request.SystemMessageCustomRequest;
import com.ssy.lingxi.message.api.vo.request.SystemMessageRequest;
import com.ssy.lingxi.message.service.IMemberMessageService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @menu 内部接口-会员消息
 * @author yzc
 * @version 2.0.0
 * @date 2020/10/27
 */
@RestController
@RequestMapping("/message/systemMessage/feign")
public class SystemMessageController extends BaseController {

    @Resource
    private IMemberMessageService messageService;

    /**
     * 发送系统消息
     * @param request 接口参数
     * @return 返回结果
     */
    @PostMapping("/send")
    public Wrapper<Void> sendSystemMessage(@RequestBody SystemMessageRequest request) {
        messageService.sendSystemMessage(request);
        return Wrapper.success();
    }

    /**
     * 发送系统消息
     * @param request 接口参数
     * @return 返回结果
     */
    @PostMapping("/batchSend")
    public Wrapper<Void> batchSendSystemMessage(@RequestBody List<SystemMessageRequest> request) {
        messageService.batchSendSystemMessage(request);
        return Wrapper.success();
    }

    /**
     * 发送自定义消息
     * @param request 接口参数
     * @return 返回结果
     */
    @PostMapping("/custom")
    public Wrapper<Void> sendCustomMessage(@RequestBody SystemMessageCustomRequest request) {
        messageService.sendCustomMessage(request);
        return Wrapper.success();
    }
}
